$.validator.setDefaults({
    submitHandler: function() {
      alert("submit!");
    }
});
$().ready(function() {
    
      $("#registration_form").validate({
        rules: {
          firstname: "required",
          surname: "required",
          email: {
            required: true,
            email: true
          },
          topic: {
            required: "#newsletter:checked",
            minlength: 2
          },
          agree: "required"
        },
        messages: {
          firstname: "please",
          lastname: "please",
          email: "please"
         }
        })
    });